home *** CD-ROM | disk | FTP | other *** search
/ 3D Games - Real-time Rend…ng & Software Technology / 3D Games - Real-time Rendering & Software Technology.iso / flysdk / plugin / lights / dyn_light.cpp next >
Encoding:
C/C++ Source or Header  |  2000-02-02  |  1.1 KB  |  70 lines

  1. #include "../../lib/Fly3D.h"
  2. #include "lights.h"
  3.  
  4. int light::step(int dt)
  5. {
  6.     if (node) 
  7.         life-=dt;
  8.  
  9.     if (directx->mpmode!=FLYMP_SERVER)
  10.         {
  11.         illum_radius+=dt*grow;
  12.         
  13.         flyengine->shadow_obj=shadow_obj;
  14.         flyengine->send_bsp_message(flyengine->bsp,pos,illum_radius,FLYOBJM_ILLUM,shadowmode,&color);
  15.         flyengine->shadow_obj=0;
  16.  
  17.         if (s)
  18.             s->step(dt);
  19.         }
  20.     return 0;
  21. }
  22.  
  23. void light::draw()
  24. {
  25.     if (s) 
  26.     {
  27.         s->pos=pos;
  28.         s->draw();
  29.     }
  30. }
  31.  
  32. int light::get_custom_param_desc(int i,param_desc *pd)
  33. {
  34.     if (pd!=0)
  35.     switch(i)
  36.     {
  37.         case 0:
  38.             pd->type='c';
  39.             pd->data=&color;
  40.             strcpy(pd->name,"color");
  41.             break;
  42.         case 1:
  43.             pd->type='f';
  44.             pd->data=&illum_radius;
  45.             strcpy(pd->name,"illumradius");
  46.             break;
  47.         case 2:
  48.             pd->type='i';
  49.             pd->data=&shadowmode;
  50.             strcpy(pd->name,"shadowmode");
  51.             break;
  52.         case 3:
  53.             pd->type='d';
  54.             pd->data=&shadow_obj;
  55.             strcpy(pd->name,"shadow_obj");
  56.             break;
  57.         case 4:
  58.             pd->type=TYPE_SPRITE_LIGHT;
  59.             pd->data=&s;
  60.             strcpy(pd->name,"sprite");
  61.             break;
  62.         case 5:
  63.             pd->type='f';
  64.             pd->data=&grow;
  65.             strcpy(pd->name,"grow");
  66.             break;
  67.     }
  68.     return 6;
  69. }
  70.